package com.naiterui.ehp.bs.patient.feign;

import com.naiterui.ehp.bp.bo.emr.InquireCaseBO;
import com.naiterui.ehp.bp.bo.emr.PatientDiseaseBO;
import com.naiterui.ehp.bp.bo.smh.SmhUserBO;
import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author gaolianlgiang
 * @date 2019-09-06 15:26
 * @since 1.0.0
 */
@FeignClient(name = "apEmr", url = "${ehp.domain.emr}", configuration = FeignConfiguration.class)
public interface EmrFeginClient {

    /**
     * @return
     * @throws BusinessException
     */
    @PostMapping("/inner/medicalRecord/getDiseaseContent")
    String getDiseaseContent(
        @RequestParam("doctorId") Long doctorId,
        @RequestParam("patientId") Long patientId,
        @RequestParam("inquirerId") Long inquirerId,
        @RequestParam("type") Integer type,
        @RequestParam("recordId") String recordId) throws BusinessException;

    @PostMapping("/inner/patient/case/white/add")
    void addCaseWhite(
        @RequestParam("doctorId") Long doctorId,
        @RequestParam("caseId") String caseId) throws BusinessException;


    /**
     * 获取病例了诊断
     *
     * @param recordId
     * @throws BusinessException
     */
    @PostMapping("/inner/medicalRecord/inquirer/case")
    InquireCaseBO getInquirerCase(@RequestParam("recordId") String recordId) throws BusinessException;

    /**
     * 获取病情诊断
     *
     * @param recordId
     * @throws BusinessException
     */
    @PostMapping("/inner/patient/disease/inquirer/case")
    InquireCaseBO getInquirerDiesase(@RequestParam("recordId") String recordId) throws BusinessException;

    /**
     * 保存病情
     *
     * @param patientId
     * @param patientDisease
     * @return
     * @throws BusinessException
     */
    @PostMapping("/inner/patient/disease/add")
    String addPatientDisease(@RequestParam("patientId") Long patientId, @RequestBody PatientDiseaseBO patientDisease)
        throws BusinessException;

    /**
     * 获取病情信息
     * @param diseaseId
     * @return
     */
    @GetMapping("inner/patient/disease/get")
    PatientDiseaseBO getPatientDisease(@RequestParam("diseaseId") String diseaseId);

    /**
     * 获取患者病情信息
     * @param patientId
     * @return
     */
    @GetMapping("inner/patient/disease/info")
    PatientDiseaseBO getDisease(@RequestParam("patientId") Long patientId);

    /**
     * 患者病情描述绑定会话
     *
     * @param recordId
     * @param sessionId
     */
    @PostMapping("/inner/patient/disease/session/bind")
    void caseSessionBind(@RequestParam("recordId") String recordId, @RequestParam("sessionId") String sessionId);

    /**
     * 根据身份证号名称获取患者HIS就诊记录
     *
     * @param inquirerMap
     * @return
     * @throws BusinessException
     */
    @PostMapping("/inner/patient/smh/case/records")
    List<SmhUserBO> getPatientRecords(@RequestBody Map<String, String> inquirerMap) throws BusinessException;

}
